'''
Copyright:
  The source code is from Internet somewhere I forgot.
'''

import requests
from aip import AipOcr

#image = requests.get('https://res.pandateacher.com/python_classic.png').content
fh = open('1.png', 'rb')
image = fh.read()
APP_ID = '16149264'
API_KEY = 'yxYg9r4OuAs4fYvfcl8tqCYd'
SECRET_KEY = 'yWg3KMds2muFsWs7MBSSFcgMQl8Wng4s'
client = AipOcr(APP_ID, API_KEY, SECRET_KEY)
res = client.basicGeneral(image)
print(res)
'''
output:
{'log_id': 7538661410773825410, 'words_result_num': 52, 'words_result': [{'words': '社会捐赠物资一览表'}, {'words': '捐赠单位(个人)'}, {'words': '品名数'}, {'words': '广州市香雪制药股份公司抗病毒口服液'}, {'words': '198箱'}, {'words': '湖南幻影三陆零农牧科技公司'}, {'words': '幻影悬浮消毒机'}, {'words': '112台'}, {'words': '幻影专用消毒包'}, {'words': '112包'}, {'words': '上海派斯德生化公司'}, {'words': '癸甲溴铵溶液'}, {'words': '100箱'}, {'words': '广西永福福中福罗汉果公司'}, {'words': '广西庆荣卫生消毒制品有限公司复方一元过氧乙酸消毒剂'}, {'words': '5箱'}, {'words': '恒大旅游集团湖北公司医用口罩'}, {'words': '箱'}, {'words': '头孢哌酮纳舒巴坦纳(舒普'}, {'words': '3360支'}, {'words': '辉瑞投资有限公司'}, {'words': '深)1.5g'}, {'words': '利奈唑胺(斯沃)600mg*10'}, {'words': '利奈唑胺(斯沃)600mg*6'}, {'words': '4800盒'}, {'words': '口罩KN95'}, {'words': '1000支'}, {'words': '找劳保网(武汉)供应链有限公司'}, {'words': '性口罩'}, {'words': '16000支'}, {'words': '医用一次性手套'}, {'words': '迈柯唯(上海)医疗设备有限公司'}, {'words': 'HLS5050套包 Magnet'}, {'words': 'PLS2050套包 Nagaet Rotflou×分'}, {'words': 'cardiohelp使用'}, {'words': '个'}, {'words': '迈柯唯(上海)医疗设备有限公司'}, {'words': '使用'}, {'words': '10个'}, {'words': 'ST-AGX1.KN95超级滤芯片'}, {'words': '1000片/箱'}, {'words': '10箱'}, {'words': '武汉子和诚饰有限公司'}, {'words': 'ST-AGX.1.K90口罩36个/56箱'}, {'words': 'STA9501KN95耳带呼吸器'}, {'words': '400个箱'}, {'words': '12箱'}, {'words': '社会捐赠现金一览表'}, {'words': '捐赠总人次'}, {'words': '1,1578人次'}, {'words': '累计接收总金额'}, {'words': '13,786,152.9元'}]}
'''

